import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { Nyt7InsuranceCategoryVO, Nyt7InsuranceCategoryForm, Nyt7InsuranceCategoryQuery } from '@/api/Nyt7InsuranceCategory/Nyt7InsuranceCategory/types';

/**
 * 查询产品分类列表
 * @param query
 * @returns {*}
 */

export const listNyt7InsuranceCategory = (query?: Nyt7InsuranceCategoryQuery): AxiosPromise<Nyt7InsuranceCategoryVO[]> => {
  return request({
    url: '/Nyt7InsuranceCategory/Nyt7InsuranceCategory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品分类详细
 * @param categoryId
 */
export const getNyt7InsuranceCategory = (categoryId: string | number): AxiosPromise<Nyt7InsuranceCategoryVO> => {
  return request({
    url: '/Nyt7InsuranceCategory/Nyt7InsuranceCategory/' + categoryId,
    method: 'get'
  });
};

/**
 * 新增产品分类
 * @param data
 */
export const addNyt7InsuranceCategory = (data: Nyt7InsuranceCategoryForm) => {
  return request({
    url: '/Nyt7InsuranceCategory/Nyt7InsuranceCategory',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品分类
 * @param data
 */
export const updateNyt7InsuranceCategory = (data: Nyt7InsuranceCategoryForm) => {
  return request({
    url: '/Nyt7InsuranceCategory/Nyt7InsuranceCategory',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品分类
 * @param categoryId
 */
export const delNyt7InsuranceCategory = (categoryId: string | number | Array<string | number>) => {
  return request({
    url: '/Nyt7InsuranceCategory/Nyt7InsuranceCategory/' + categoryId,
    method: 'delete'
  });
};

